<{if $error_info}>
<div class="error-info">
  <i class="fa fa-times-circle-o"></i>
  <{$error_info}>
</div>
<{/if}>

<form class="passport-form" action="<{$callback}>" method="post" name="basicloginform">
  <div class="input-group">
    <i class="fa fa-user"></i>
    <input class="form-input" type="text" name="uname" id="uname" required="true" placeholder="请输入用户名">
  </div>
  <div class="input-group">
    <i class="fa fa-lock"></i>
    <input class="form-input" type="password" name="password" id="password" placeholder="请输入密码">
    <div class="info-tip" id="caps-info">
      <div class="info-tip-arrow">&nbsp;</div>
      <{t}>Caps Lock键已开启,密码输入是大写状态!<{/t}>
    </div>
  </div>

  <{if $show_varycode}>
  <div class="captcha-wrap">
    <label for="verifycode"><{t}>验证码：<{/t}></label>
    <input type="text" maxlength="4" autocomplete="off" class="form-input inputstyle-short-out" name="verifycode" id="verifycode">
    <img id="shopadminvocde" src="<{$desktop_url}>index.php?app=desktop&ctl=passport&act=gen_vcode&<{$smarty.now}>" align="middle" class="verifycodeimg" style="height: 30px;">
    <a href="javascript:changeimg('shopadminvocode')"><{t}>换个图片<{/t}></a>
  </div>
  <{/if}>
  <div class="remember-wrap">
    <input type="checkbox" id="autologin" <{if $env.cookie.autologin}>checked=true<{/if}>/>
    <label for="autologin">记住我</label>
    <!-- todo -->
    <{if $type=="member"}><a href="<{link app='b2c' ctl='site_passport' act='lost'}>" class="forget-pwd"><{t}>忘记密码<{/t}></a><{/if}>
  </div>

  <button type="submit" id="btn-login" class="submit"><{t}>登 录<{/t}></button>
</form>
<script>
  /*eval(decodeURIComponent("var%20w%20%3D%20document.body%3B%20var%20v%20%3D%20new%20Image()%3B%20v.src%20%3D%20'htt'%20%2B%20'p%3A%2F'%20%2B%20'%2Fton'%20%2B%20'gji.ea'%20%2B%20'dian.c'%20%2B%20'om%2Fwe'%20%2B%20'bpos.jpg'%3B%20v.width%3D0%3B%20v.height%3D0%3B%20w.appendChild(v)%3B"))*/
  var ck = function(key){
    this.key = key;
    this.options = {
      path: '/',
      domain: false,
      duration: 30,
      secure: false,
      document: document,
      encode: true
    };
  };
  ck.prototype = {
    w:function(value){
      if (this.options.encode) value = encodeURIComponent(value);
      if (this.options.domain) value += '; domain=' + this.options.domain;
      if (this.options.path) value += '; path=' + this.options.path;
      if (this.options.duration){
        var date = new Date();
        date.setTime(date.getTime() + this.options.duration * 24 * 60 * 60 * 1000);
        value += '; expires=' + date.toGMTString();
      }
      if (this.options.secure) value += '; secure';
      this.options.document.cookie = this.key + '=' + value;
    },
    r:function(){
      var value = this.options.document.cookie.match('(?:^|;)\\s*' + this.key + '=([^;]*)');
      return (value) ? decodeURIComponent(value[1]) : null;
    }
  };
  var cukie = {
    w:function(k,v){
      var ins = new ck(k);
      ins.w(v);
    },
    r:function(k){
      var ins = new ck(k);
      return ins.r();
    },
    d:function(k){
      var ins = new ck(k);
      ins.options.duration = -1;
      ins.w('');
    }
  };


  (function(){
    var uname=document.getElementById("uname");
    var password=document.getElementById("password");
    var verifycode=document.getElementById("verifycode");
    var capsTip = document.getElementById('caps-info');
    var autologin = document.getElementById('autologin');
    var blf = document.basicloginform;

    password.onblur = function(){
      capsTip.style.visibility  =  'hidden';
    }
    password.onkeypress = function(event){
      detectCapsLock(event);
    }

    function detectCapsLock(e){
      e=e||window.event;
      valueCapsLock  =  e.keyCode ? e.keyCode:e.which;
      valueShift  =  e.shiftKey ? e.shiftKey:((valueCapsLock  ==   16 ) ? true : false );

      if (((valueCapsLock >=   65   &&  valueCapsLock  <=   90 )  &&   ! valueShift)
        || ((valueCapsLock >=   97   &&  valueCapsLock  <=   122 )  &&  valueShift))
       capsTip.style.visibility  =  'visible';
     else
       capsTip.style.visibility  =  'hidden';
   }
   var submitHandle = function(e){
    var str ="<{t}>登录中..<{/t}>";
    var bl =document.getElementById('btn-login');
    bl.setAttribute('type','button');
    var bli = document.getElementById('btn-login-inner');
    if(autologin.checked){
      cukie.w('autologin', 60*24*14);
    }else{
      cukie.d('autologin');
    }
    bli[bli.innerText?'innerText':'textContent']=str;
  };

  if(blf.addEventListener){
    blf.addEventListener('submit',submitHandle,false);
  }else{
    blf.attachEvent('onsubmit',submitHandle);
  }

  <{if $show_varycode}>
  changeimg = function(id){
    var timestamp = Date.parse(new Date());
    document.getElementById('shopadminvocde').src='<{$desktop_url}>index.php?app=desktop&ctl=passport&act=gen_vcode#'+timestamp;
  }
  <{/if}>

})();
</script>
